<?php

class module_sl_kinhtexahoi extends base_layout {
    /*
    public $table = array();
    public $curTag = "";
    public $colIndex = null;
    
    function startElementHandler($parser, $name, $attrib) {
        switch ($name) {
            case "TABLE":
                $this->table[] = array("title" => $attrib["TITLE"], "header" => array());
                break;
            case "HEADER":
            case "ITEM":
                $this->curTag = $name;
                break;
            case "COL":
                $tableIndex = count($this->table) - 1;

                if ($this->colIndex == null) {
                    $this->colIndex = 0;
                    if ($this->curTag == "ITEM") {
                        $itemIndex = count($this->table[$tableIndex]) - 2;
                        $this->table[$tableIndex][$itemIndex] = array();
                    }
                }
                if ($this->curTag == "HEADER") $this->table[$tableIndex]["header"][$this->colIndex] = "";
                if ($this->curTag == "ITEM") {
                    $itemIndex = count($this->table[$tableIndex]) - 3;
                    $this->table[$tableIndex][$itemIndex][$this->colIndex] = "";
                }
                
                $this->curTag .= "-" . $name;
                break;
        }
    }
    
    function endElementHandler($parser, $name) {
        switch ($name) {
            case "COL":
                if ($this->curTag == "HEADER-COL") $this->curTag = "HEADER";
                if ($this->curTag == "ITEM-COL") $this->curTag = "ITEM";
                $this->colIndex++;
                break;
            case "HEADER":
            case "ITEM":
                $this->colIndex = null;
                break;
        }
    }
    
    function characterDataHandler($parser, $data) {
        $tableIndex = count($this->table) - 1;
        switch ($this->curTag) {
            case "HEADER-COL":
                $this->table[$tableIndex]["header"][$this->colIndex] .= $data;
                break;
            case "ITEM-COL":
                $itemIndex = count($this->table[$tableIndex]) - 3;
                $this->table[$tableIndex][$itemIndex][$this->colIndex] .= $data;
                break;
        }
    }
    
    public function openXML($xmlFileName) {
        global $g_factory;
        if (!($fp = @fopen($g_factory->base_constants["path"]["data"] . "/" . $xmlFileName, "r"))) die ("Không tìm thấy dữ liệu! Vui lòng thử lại sau.");
        if (!($xml_parser = xml_parser_create())) die("Không thể đọc được dữ liệu! Vui lòng thử lại sau.");
        
        xml_set_element_handler($xml_parser, array(&$this, "startElementHandler"), array(&$this, "endElementHandler"));
        xml_set_character_data_handler( $xml_parser, array(&$this, "characterDataHandler"));

        while( $data = fread($fp, 4096))
            if (!xml_parse($xml_parser, $data, feof($fp))) break;
        
        xml_parser_free($xml_parser);
		
		$this->_smartyVars["slkinhtexahoi_menu"] = array();
		$tableLen = count($this->table);
		for ($i=0; $i < $tableLen; $i++) {
			$this->_smartyVars["slkinhtexahoi_menu"][] = array($this->table[$i]["title"], "solieu_ktxh.php?i=$i");
		}
    }
    */
	/** CONSTRUCTOR
     *  @param string $TPLfile: path to tpl file
     *  @param string|array $cssLink: contains multiple or single link(s) to css
     *  @param string|array $jsLink: contains multiple or single link(s) to js
     *  @param array $smartyVars: array contains initial smarty variables ($key => $value form)
     */
    public function __construct($TPLfile, $cssLink = null, $jsLink = null, $smartyVars = null) {
        parent::__construct($TPLfile, $cssLink, $jsLink, $smartyVars);
    }
}

?>